// haojk/pages/commissionWithdraw/index.js
var app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        inputValue:""
      
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var $that = this;
    

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },


    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    startSubmit:function(){
        var $that = this;
      
        if ($that.data.inputValue == null || $that.data.inputValue == undefined ||$that.data.inputValue == ""){
            wx.showModal({
                title: '提示',
                content: '订单号不能为空',
                success: function (res) {
                    if (res.confirm) {
                    
                    } else if (res.cancel) {
                      
                    }
                }
            })

        }else{
            app.util.request({
                url: 'entry/wxapp/SubmitOrder',
                data: {
                    m: 'nets_haojk',
                    orderno: $that.data.inputValue

                },
                method: 'post',
                success: function (response) {
                    if(response.data.data==1){
                        wx.showModal({
                            title: '提示',
                            content: "提单成功，请等待审核",
                            success: function (res) {
                                if (res.confirm) {
                                   


                                    wx.switchTab({
                                        url: "../my/index",
                                        success: function (e) {
                                            var page = getCurrentPages().pop();
                                            if (page == undefined || page == null) return;
                                            page.onLoad();
                                        }
                                    })
                                } else if (res.cancel) {
                                   
                                }
                            }
                        })

                    }else{
                        wx.showModal({
                            title: '提示',
                            content: response.data.message,
                            success: function (res) {
                                if (res.confirm) {
                                  
                                } else if (res.cancel) {
                                   
                                }
                            }
                        })
                    }
                
                }
            })
        }
        


    },

    changeInput:function(e){
        this.setData({ inputValue: e.detail.value})
        if (this.data.borderShow) {
            this.setData({ borderShow: false})
        }

    }

})